filechooserdialog: Stop using the embed interface
authorMatthias Clasen <mclasen@redhat.com>
Sun, 12 Jul 2020 14:34:27 +0000 (10:34 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 12 Jul 2020 14:59:49 +0000 (10:59 -0400)
Just call private GtkFileChooserWidget api. There
is no real justification for diverting this through
an extra interface.

gtk/gtkfilechooserdialog.c
gtk/gtkfilechooserwidget.c
gtk/gtkfilechooserwidgetprivate.h

index d27ba8e3c07fe2102062d17955531249a5a69e4d..094a25f15b92fbd28e56a4745e18a1d2f1901842 100644 (file)
@@ -25,7 +25,6 @@
 #include "gtkfilechooserwidget.h"
 #include "gtkfilechooserwidgetprivate.h"
 #include "gtkfilechooserutils.h"
-#include "gtkfilechooserembed.h"
 #include "gtksizerequest.h"
 #include "gtktypebuiltins.h"
 #include "gtkintl.h"
@@ -606,7 +605,7 @@ gtk_file_chooser_dialog_map (GtkWidget *widget)
   setup_save_entry (dialog);
   ensure_default_response (dialog);
 
-  _gtk_file_chooser_embed_initial_focus (GTK_FILE_CHOOSER_EMBED (priv->widget));
+  gtk_file_chooser_widget_initial_focus (GTK_FILE_CHOOSER_WIDGET (priv->widget));
 
   GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->map (widget);
 }
@@ -670,7 +669,7 @@ response_cb (GtkDialog *dialog,
   /* Act only on response IDs we recognize */
   if (is_accept_response_id (response_id) &&
       !priv->response_requested &&
-      !_gtk_file_chooser_embed_should_respond (GTK_FILE_CHOOSER_EMBED (priv->widget)))
+      !gtk_file_chooser_widget_should_respond (GTK_FILE_CHOOSER_WIDGET (priv->widget)))
     {
       g_signal_stop_emission_by_name (dialog, "response");
     }
index f431dbadf06afa2f1b5f6bb0c60396d753372e73..5eebc04bd321fb88fb5d98563962a932cbca9a18 100644 (file)
@@ -34,7 +34,6 @@
 #include "gtkentry.h"
 #include "gtkfilechooserprivate.h"
 #include "gtkfilechooserdialog.h"
-#include "gtkfilechooserembed.h"
 #include "gtkfilechooserentry.h"
 #include "gtkfilechooserutils.h"
 #include "gtkfilechooser.h"
@@ -388,7 +387,6 @@ enum {
 #define ICON_SIZE 16
 
 static void gtk_file_chooser_widget_iface_init       (GtkFileChooserIface        *iface);
-static void gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface   *iface);
 
 static void     gtk_file_chooser_widget_constructed  (GObject               *object);
 static void     gtk_file_chooser_widget_finalize     (GObject               *object);
@@ -441,9 +439,6 @@ static gboolean       gtk_file_chooser_widget_remove_shortcut_folder (GtkFileCho
                                                                        GError           **error);
 static GListModel *   gtk_file_chooser_widget_get_shortcut_folders   (GtkFileChooser    *chooser);
 
-static gboolean       gtk_file_chooser_widget_should_respond         (GtkFileChooserEmbed *chooser_embed);
-static void           gtk_file_chooser_widget_initial_focus          (GtkFileChooserEmbed *chooser_embed);
-
 static void        gtk_file_chooser_widget_add_choice    (GtkFileChooser  *chooser,
                                                           const char      *id,
                                                           const char      *label,
@@ -547,9 +542,7 @@ static void     set_show_hidden              (GtkFileChooserWidget *impl,
 
 G_DEFINE_TYPE_WITH_CODE (GtkFileChooserWidget, gtk_file_chooser_widget, GTK_TYPE_WIDGET,
                          G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER,
-                                                gtk_file_chooser_widget_iface_init)
-                         G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER_EMBED,
-                                                gtk_file_chooser_embed_default_iface_init));
+                                                gtk_file_chooser_widget_iface_init))
 
 static void
 gtk_file_chooser_widget_iface_init (GtkFileChooserIface *iface)
@@ -575,13 +568,6 @@ gtk_file_chooser_widget_iface_init (GtkFileChooserIface *iface)
   iface->get_choice = gtk_file_chooser_widget_get_choice;
 }
 
-static void
-gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface)
-{
-  iface->should_respond = gtk_file_chooser_widget_should_respond;
-  iface->initial_focus = gtk_file_chooser_widget_initial_focus;
-}
-
 static void
 pending_select_files_free (GtkFileChooserWidget *impl)
 {
@@ -6117,10 +6103,9 @@ add_selection_to_recent_list (GtkFileChooserWidget *impl)
   g_object_unref (files);
 }
 
-static gboolean
-gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
+gboolean
+gtk_file_chooser_widget_should_respond (GtkFileChooserWidget *impl)
 {
-  GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser_embed);
   GtkWidget *toplevel;
   GtkWidget *current_focus;
   gboolean retval;
@@ -6366,11 +6351,9 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
   return retval;
 }
 
-/* Implementation for GtkFileChooserEmbed::initial_focus() */
-static void
-gtk_file_chooser_widget_initial_focus (GtkFileChooserEmbed *chooser_embed)
+void
+gtk_file_chooser_widget_initial_focus (GtkFileChooserWidget *impl)
 {
-  GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser_embed);
   GtkWidget *widget;
 
   if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
index 2c00f6ff8a4f2c963d0346bf403219dac9ef5387..07b0ce3897437bf5a5eba46d19f34520880a75f9 100644 (file)
@@ -30,6 +30,12 @@ void
 gtk_file_chooser_widget_set_save_entry (GtkFileChooserWidget *chooser,
                                         GtkWidget            *entry);
 
+gboolean
+gtk_file_chooser_widget_should_respond (GtkFileChooserWidget *chooser);
+
+void
+gtk_file_chooser_widget_initial_focus  (GtkFileChooserWidget *chooser);
+
 G_END_DECLS
 
 #endif /* __GTK_FILE_CHOOSER_WIDGET_PRIVATE_H__ */